import xlrd

class ExlOpera:

    def __init__(self,path='../../config/AutoCase.xls'):
        with xlrd.open_workbook(path) as workbook:
            self.workbook=workbook

    # 通过name选择工作簿
    def get_sheet(self,sheet_name):
        self.data=self.workbook.sheet_by_name(sheet_name)

    def get_row(self):  #获取总行数
        return self.data.nrows

    def get_col(self):  #获取总列数
        return self.data.ncols

    def get_cell(self,row,col):  #获取第几行第几列
        return self.data.cell_value(row,col)


# exl=ExlOpera()
# exl.get_sheet('登录用例参数')
# print(exl.get_cell(4,2))